#ifndef MOTOR_CONTROLER_H_
#define MOTOR_CONTROLER_H_

#include "PIDControler.h"
#include "OptoCounter.h"
#include "CDatapoolServer.h"

class Motors;

class MotorControler
{
	public:
	
		Motors * m_ActuatorGroup;

		int m_motorId;
		double m_Consigne;
		int m_MotorSentPower;

		MotorControler(Motors * ActuatorGroup,
				 int motor_id, 
			 	 double pid_coef_p, 
			 	 double pid_coef_i, 
			 	 double pid_coef_d, 
			 	 int pid_out_max, 
			 	 int opto_gpio, 
			 	 int opto_freq_div);

		~MotorControler();

		void SetMotorValue(double NouvelleConsigne);

		double ImportInputValue();
		void Iteration();

	protected:

		OptoCounter * m_Opto;
		PIDControler * m_Pid;
	
		void ExportOutputValue(double NouvelleConsigne);
};

#endif //MOTOR_CONTROLER_H_
